# 员工信息

class Employee(object):
    """
    员工类
    """

    def __init__(self, name, gender, age, mobile_number, is_leave=0):
        """

        :param name: 姓名
        :param gender: 性别
        :param age: 年龄
        :param mobile_number: 电话号码
        :param is_leave: 是否离职 (1表示离职，0表示在职)
        """
        self.name = name
        self.gender = gender
        self.age = age
        self.mobile_number = mobile_number
        self.is_leave = False if is_leave == 0 else True

    def __str__(self):
        msg = "离职" if self.is_leave else "在职"
        return f'{self.name}\t{self.gender}\t{self.age}\t{self.mobile_number}\t{msg}'


if __name__ == '__main__':
    e = Employee('张三', '男', 25, '15591727456')
    print(e.__dict__)  # 1. 把Python对象转换成字典
    print(vars(e))  # 2. python内置函数 两种方式都可以将对象转换成字典
    print(e)
